package com.bottomlord.security;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
import org.springframework.security.config.annotation.web.builders.HttpSecurity;
import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter;

import java.util.List;

/**
 * @author ChenYue
 * @date 2021/4/30 11:07
 */
@Configuration
public class CompositeWebSecurityConfigurerAdapter extends WebSecurityConfigurerAdapter {
    private List<HttpSecurityConfigurer> httpSecurityConfigurers;

    @Autowired
    public void setHttpSecurityConfigurers(List<HttpSecurityConfigurer> httpSecurityConfigurers) {
        this.httpSecurityConfigurers = httpSecurityConfigurers;
    }

    @Override
    protected void configure(HttpSecurity http) throws Exception {
        for (HttpSecurityConfigurer httpSecurityConfigurer : httpSecurityConfigurers) {
            httpSecurityConfigurer.configure(http);
        }
    }
}
